from celery1 import app
from .models import BackendLog
from django.utils import timezone
import datetime

seven_days_ago = timezone.now() - datetime.timedelta(days=30)


@app.task()
def del_old_log():
    # 清理长期的日志数据
    BackendLog.objects.filter(create_time__lt=seven_days_ago).delete()
